package cn.udinghuo.model.archives.option;

import com.fasterxml.jackson.annotation.JsonSetter;

import org.springframework.util.Assert;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Column;
import cn.udinghuo.core.domain.entity.BaseEntity;	
import cn.udinghuo.model.archives.option.FunctionOptionSysTypeEnum;	
import cn.udinghuo.model.archives.option.FunctionOptionValueDataTypeEnum;	
import cn.udinghuo.model.archives.option.FunctionOptionValueTypeEnum;	
import java.util.List;	
import cn.udinghuo.model.archives.option.vo.OptionValuesListVO;	
import cn.udinghuo.core.domain.entity.Comment;
import cn.udinghuo.core.domain.entity.ita.CacheKey;
import cn.udinghuo.core.domain.entity.ita.NotIdCache;

/**
 * @author xufla
 *	业务选项公共设置
 */
@Entity
@NotIdCache
@Table(name="functionoptionbase")
public class FunctionOptionBase extends BaseEntity<Long>  {

	private static final long serialVersionUID = 2130706432L;
	/**
	* 选项名称captionName
	*/
	@Comment(value="选项名称")
	@Column(name="cCaptionName", length = 100)
	private String captionName;
	/**
	* 选项编码code
	*/
	@Comment(value="选项编码")
	@Column(name="cCode", length = 100)
	private String code;
	/**
	* 可选值集合values
	*/
	@Comment(value="可选值集合")
	@Column(name="cValues", length = 255)
	private String values;
	/**
	* 选项值value
	*/
	@Comment(value="选项值")
	@Transient
	private String value;
	/**
	* 值名称valueName
	*/
	@Comment(value="值名称")
	@Transient
	private String valueName;
	/**
	* 默认值defaultValue
	*/
	@Comment(value="默认值")
	@Column(name="cDefaultValue", length = 30)
	private String defaultValue;
	/**
	* 值类型valueType
	*/
	@Comment(value="值类型")
	@Column(name="cValueType", length = 20)
	private String valueType;
	/**
	* 可选值集合数据结构类型valueDataType
	*/
	@Comment(value="可选值集合数据结构类型")
	@Column(name="cValueDataType", length = 20)
	private String valueDataType;
	/**
	* 业务选项值键值对集合valueMaps
	*/
	@Comment(value="业务选项值键值对集合")
	@Transient
	private List<OptionValuesListVO> valueMaps;
	/**
	* 选项所属业务类型名称sysTypeName
	*/
	@Comment(value="选项所属业务类型名称")
	@Transient
	private String sysTypeName;
	/**
	* 选项所属业务类型编码sysType
	*/
	@Comment(value="选项所属业务类型编码")
	@Column(name="cSysType", length = 20)
	private String sysType;
	/**
	* 是否可用enable
	*/
	@Comment(value="是否可用")
	@Column(name="bEnable")
	private Boolean enable;
	/**
	* 是否可见visible
	*/
	@Comment(value="是否可见")
	@Column(name="bVisible")
	private Boolean visible;
	/**
	* 是否默认开启defaultEnable
	*/
	@Comment(value="是否默认开启")
	@Column(name="bDefaultEnable")
	private Boolean defaultEnable;
	/**
	* 值改变前干预事件beforCheckMethod
	*/
	@Comment(value="值改变前干预事件")
	@Column(name="cBeforCheckMethod", length = 50)
	private String beforCheckMethod;
	/**
	* 说明memo
	*/
	@Comment(value="说明")
	@Column(name="cMemo", length = 8000)
	private String memo;
	/**
	* 排序sort
	*/
	@Comment(value="排序")
	@Column(name="iOrder")
	private Double sort;
	/**
	* 业务类型排序typeSort
	*/
	@Comment(value="业务类型排序")
	@Column(name="iTypeOrder", length = 2)
	private Integer typeSort;
	public String getCaptionName() {
		return this.captionName;
	}
	
	public void setCaptionName(String value) {
		this.captionName = value;
	}
	
	@CacheKey
	public String getCode() {
		return this.code;
	}
	
	public void setCode(String value) {
		this.code = value;
	}
	
	public String getValues() {
		return this.values;
	}
	
	public void setValues(String value) {
		this.values = value;
	}
	
	public String getValue() {
		return this.value;
	}
	
	public void setValue(String value) {
		this.value = value;
	}
	
	public String getValueName() {
		return this.valueName;
	}
	
	public void setValueName(String value) {
		this.valueName = value;
	}
	
	public String getDefaultValue() {
		return this.defaultValue;
	}
	
	public void setDefaultValue(String value) {
		this.defaultValue = value;
	}
	
	public FunctionOptionValueTypeEnum getValueType() {
		return FunctionOptionValueTypeEnum.find(this.valueType);
	}
	
	@JsonSetter
	public void setValueType(FunctionOptionValueTypeEnum value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.valueType = value.getName();
	}
	
	public void setValueType(String value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(FunctionOptionValueTypeEnum.find(value),"enum value is invalid value!"); 
		this.valueType = value;
	}
	
	public FunctionOptionValueDataTypeEnum getValueDataType() {
		return FunctionOptionValueDataTypeEnum.find(this.valueDataType);
	}
	
	@JsonSetter
	public void setValueDataType(FunctionOptionValueDataTypeEnum value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.valueDataType = value.getName();
	}
	
	public void setValueDataType(String value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(FunctionOptionValueDataTypeEnum.find(value),"enum value is invalid value!"); 
		this.valueDataType = value;
	}
	
	public List<OptionValuesListVO> getValueMaps() {
		return this.valueMaps;
	}
	
	public void setValueMaps(List<OptionValuesListVO> value) {
		this.valueMaps = value;
	}
	
	public String getSysTypeName() {
		return this.sysTypeName;
	}
	
	public void setSysTypeName(String value) {
		this.sysTypeName = value;
	}
	
	public FunctionOptionSysTypeEnum getSysType() {
		return FunctionOptionSysTypeEnum.find(this.sysType);
	}
	
	@JsonSetter
	public void setSysType(FunctionOptionSysTypeEnum value) {
		Assert.notNull(value, "enum value is invalid value!");
		this.sysType = value.getName();
	}
	
	public void setSysType(String value) {
		Assert.notNull(value,"enum value is invalid value!");
		Assert.notNull(FunctionOptionSysTypeEnum.find(value),"enum value is invalid value!"); 
		this.sysType = value;
	}
	
	public Boolean getEnable() {
		return this.enable;
	}
	
	public void setEnable(Boolean value) {
		this.enable = value;
	}
	
	public Boolean getVisible() {
		return this.visible;
	}
	
	public void setVisible(Boolean value) {
		this.visible = value;
	}
	
	public Boolean getDefaultEnable() {
		return this.defaultEnable;
	}
	
	public void setDefaultEnable(Boolean value) {
		this.defaultEnable = value;
	}
	
	public String getBeforCheckMethod() {
		return this.beforCheckMethod;
	}
	
	public void setBeforCheckMethod(String value) {
		this.beforCheckMethod = value;
	}
	
	public String getMemo() {
		return this.memo;
	}
	
	public void setMemo(String value) {
		this.memo = value;
	}
	
	public Double getSort() {
		return this.sort;
	}
	
	public void setSort(Double value) {
		this.sort = value;
	}
	
	public Integer getTypeSort() {
		return this.typeSort;
	}
	
	public void setTypeSort(Integer value) {
		this.typeSort = value;
	}
	
}
